package main

import "fmt"

// 公司
type company struct {
	companyName string
	companyAddr string
}

// 职员
type staff struct {
	name     string
	age      int
	gender   int
	position string
}

// 直接将数据全部揉到一起，这是最笨的办法
type staffWithCompany struct {
	name        string
	age         int
	gender      int
	position    string
	companyName string
	companyAddr string
}

// staff组合company
type staffAssemblyCompany struct {
	name     string
	age      int
	gender   int
	position string
	company
}

func main() {
	myCompany := company{
		companyName: "Topwalk",
		companyAddr: "成都市高新区",
	}
	staffInfo := staffAssemblyCompany{
		name:     "小汤",
		age:      28,
		gender:   1,
		position: "Java开发工程师",
		company:  myCompany,
	}

	fmt.Printf("%s 在 %s 工作\n", staffInfo.name, staffInfo.companyName)
	fmt.Printf("%s 在 %s 工作\n", staffInfo.name, staffInfo.company.companyName)
}
